package com.diy.sigmund.diyuser.controller;

import com.diy.sigmund.diycommon.entity.ResultMsg;
import com.diy.sigmund.diyuser.service.SeataUserService;
import java.math.BigDecimal;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 积分处理控制类
 *
 * @author ylm-sigmund
 * @since 2021/11/5 15:59
 */
@RestController
@RequestMapping("")
public class SeataUserController {

    @Autowired
    private SeataUserService seataUserService;

    private static final Logger log = LoggerFactory.getLogger(SeataUserController.class);

    @RequestMapping("/user/seataUser/decreaseInventory")
    public ResultMsg decreaseInventory(@RequestParam String commodityId, @RequestParam Integer transactionQuantity) {
        return seataUserService.decreaseInventory(commodityId, transactionQuantity);
    }

    @RequestMapping("/user/seataUser/decreaseAccount")
    public ResultMsg decreaseAccount(@RequestParam String phone, @RequestParam BigDecimal transactionAmount) {
        return seataUserService.decreaseAccount(phone, transactionAmount);
    }
}
